package fr.generali.poc.statemachine.states;

import fr.generali.poc.statemachine.events.Event;
import fr.generali.poc.statemachine.model.Dossier;
import fr.generali.poc.statemachine.model.TransitionModel;
import fr.generali.poc.statemachine.transitions.CreerSuspensTransition;
import fr.generali.poc.statemachine.transitions.UpdateSuspensTransition;

public class StateB extends StateAbstract {

	public static String NAME = "STATE_B";

	private static StateB sInstance = new StateB();

	private StateB() {
	}

	public static StateB getInstance() {
		return sInstance;
	}

	public TransitionModel getTransition(Dossier d, Event e) {
		TransitionModel transitionModel = null;
		if (Event.EVENT_B_MODIFY.equals(e) && "1".equals(d.getDonnees())) {
			transitionModel = new TransitionModel(StateA.getInstance(),
					CreerSuspensTransition.NAME);
		} else {
			transitionModel = new TransitionModel(StateB.getInstance(),
					UpdateSuspensTransition.NAME);
		}
		// TODO Auto-generated method stub
		return transitionModel;
	}

	public String getNAME() {
		return NAME;
	}

}
